﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace ThoiTrangT2B
{
    public partial class UCProductList : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public void SetData(string category, int ID, DataTable dt)
        {
            lblCategory.Text = category;
            hplXemtatca.NavigateUrl = "XemSanPham.aspx?cID=" + ID;
            string Img;
            string hang;
            string ten;
            int pID;
            string gia;
            string giacu;
            string km;
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                UCProductBlock Items = (UCProductBlock)LoadControl("UCProductBlock.ascx");
                Img = dt.Rows[i]["Image"].ToString();
                hang = dt.Rows[i]["Hang"].ToString();
                ten = dt.Rows[i]["TenSP"].ToString();
                ID = Convert.ToInt32(dt.Rows[i]["ID"].ToString());
                gia = dt.Rows[i]["Gia"].ToString();
                giacu = dt.Rows[i]["Giacu"].ToString();
                km = dt.Rows[i]["KM"].ToString();
                Items.setValue(ID, Img, hang, ten, gia, giacu, km);
                ProductHolder.Controls.Add(Items);
            }
        }
    }
}